package buaa.leetcode.DynamicPrograming;

public class ClimbingStairs {
	  public static int climbStairs(int n) {
		  if(n <= 0){
			  return 0;
		  }else if(n == 1){
			  return 1;
		  }else if(n ==2){
			  return 2;
		  }else{
			  int[] t = new int[n+1];
			  t[1] = 1;
			  t[2] = 2;
			  for(int i = 3;i <= n;i++){
				  t[i] = t[i-1] + t[i-2];
			  }
			  return t[n];
		  }
	  }
	  public static void mian(String[] args){
		System.out.println(climbStairs(4));
	  }
}
